local tssj = fk.CreateSkill {

  name = "joy_nian_tssj",

  tags = {  },

}



tssj:addEffect("active", {
  name = "joy_nian_tssj",
    anim_type = "drawcard",
    target_num = 0,
    card_num = 0,
    prompt = "#joy_nian_tssj",
    card_filter = Util.FalseFunc,
    target_filter = Util.FalseFunc,
    on_use = function(self, room, effect)
      local player = effect.from
      local kin = player.kingdom
      for _, p in ipairs(room:getOtherPlayers(player)) do
        if p.kingdom == kin then
            local card = p:drawCards(1,tssj.name)
            if player.dead then break end
            if not p.dead then
                local tri = false
                for _, cid in ipairs(p:getCardIds("h")) do
                    if Fk:getCardById(cid).type == Card.TypeTrick then
                        tri = true
                        break
                    end
                end
                if tri then
                   local cs = room:askForCard(p,1,1,false,tssj.name,false,".|.|.|.|.|trick","#joy_nian_tssj-ask::"..player.id)
                    if #cs > 0 then
                        room:moveCardTo(cs,Card.PlayerHand,player,fk.ReasonGive)
                    end
                elseif room:getCardArea(card[1]) == Player.Hand and room:getCardOwner(card[1]) == p then
                    room:moveCardTo(card,Card.PlayerHand,player,fk.ReasonGive)
                end
            end
        end
      end
    end,
})

return tssj